home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / python2.6-minimal.postinst < prev    next >
Text File  |  2009-11-02  |  2KB  |  77 lines

  1. #! /bin/sh
  2.  
  3. set -e
  4.  
  5. if [ ! -f /etc/python2.6/sitecustomize.py ]; then
  6.     cat <<-EOF
  7.     # Empty sitecustomize.py to avoid a dangling symlink
  8. EOF
  9. fi
  10.  
  11. syssite=/usr/lib/python2.6/site-packages
  12. localsite=/usr/local/lib/python2.6/dist-packages
  13. syslink=../../${localsite#/usr/*}
  14.  
  15. case "$1" in
  16.     configure)
  17.         # Create empty directories in /usr/local
  18.         if [ ! -e /usr/local/lib/python2.6 ]; then
  19.             mkdir -p /usr/local/lib/python2.6 2> /dev/null || true
  20.             chmod 2775 /usr/local/lib/python2.6 2> /dev/null || true
  21.             chown root:staff /usr/local/lib/python2.6 2> /dev/null || true
  22.         fi
  23.         if [ ! -e $localsite ]; then
  24.             mkdir -p $localsite 2> /dev/null || true
  25.             chmod 2775 $localsite 2> /dev/null || true
  26.             chown root:staff $localsite 2> /dev/null || true
  27.         fi
  28.     #if [ ! -h $syssite ]; then
  29.     #    ln -s $syslink $syssite
  30.     #fi
  31.  
  32.     if which update-binfmts >/dev/null; then
  33.         update-binfmts --import python2.6
  34.     fi
  35.  
  36.     ;;
  37. esac
  38.  
  39. if [ "$1" = configure ]; then
  40.     (
  41.     files=$(dpkg -L python2.6-minimal | sed -n '/^\/usr\/lib\/python2.6\/.*\.py$/p')
  42.     python2.6 /usr/lib/python2.6/py_compile.py $files
  43.     if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then
  44.         python2.6 -O /usr/lib/python2.6/py_compile.py $files
  45.     fi
  46.     )
  47.     bc=no
  48.     if [ -z "$2" ] || dpkg --compare-versions "$2" lt 2.6.1-1ubuntu8 \
  49.         || [ -f /var/lib/python/python2.6_installed ]; then
  50.     bc=yes
  51.     fi
  52.     if grep -sq '^unsupported-versions[^#]*python2.6' /usr/share/python/debian_defaults
  53.     then
  54.     # FIXME: byte compile anyway?
  55.     bc=no
  56.     fi
  57.     if [ "$bc" = yes ]; then
  58.     # new installation or installation of first version with hook support
  59.     if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  60.         echo "Linking and byte-compiling packages for runtime python2.6..."
  61.     fi
  62.     version=$(dpkg -s python2.6-minimal | awk '/^Version:/ {print $2}')
  63.     for hook in /usr/share/python/runtime.d/*.rtinstall; do
  64.         [ -x $hook ] || continue
  65.         $hook rtinstall python2.6 "$2" "$version"
  66.     done
  67.     if [ -f /var/lib/python/python2.6_installed ]; then
  68.         rm -f /var/lib/python/python2.6_installed
  69.         rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null
  70.     fi
  71.     fi
  72. fi
  73.  
  74.  
  75.  
  76. exit 0
  77.